package com.example.springboot.config.logFilter;

import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;

import java.util.Arrays;

/**
 * @Author:ChenZhangKun
 * @Date: 2021/4/28 16:26
 */
@ConditionalOnWebApplication
public class LogFilterWebConfig {
    /*    @Bean
        public LogFilter logFilter() {
            return new LogFilter();
        }*/
    @Bean
    public FilterRegistrationBean czkFilterRegistrationBean() {
        FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
        filterRegistrationBean.setFilter(new LogFilter());
        filterRegistrationBean.setUrlPatterns(Arrays.asList("/test1"));
        return filterRegistrationBean;
    }
}
